package com.dance.java8.day01.date;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.concurrent.*;

public class TestSimpleDateFormat {

    public static void main(String[] args) throws ExecutionException, InterruptedException {

//        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");

        ExecutorService executorService = Executors.newFixedThreadPool(10);

        Callable<Date> callable = () -> DateFormatThreadLocal.convert("20161218");

        List<Future<Date>> list = new ArrayList<>();

        for (int i = 0; i < 10; i++) {
            list.add(executorService.submit(callable));
        }

        for (Future<Date> dateFuture : list) {
            System.out.println(dateFuture.get());
        }

        executorService.shutdown();

    }

}
